Add visible and visible_set args, don't know where these had gone, I
authorHavoc Pennington <hp@pobox.com>
Thu, 9 Nov 2000 04:51:53 +0000 (04:51 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Thu, 9 Nov 2000 04:51:53 +0000 (04:51 +0000)
2000-11-08  Havoc Pennington  <hp@pobox.com>

* gtk/gtktexttag.c (gtk_text_tag_class_init): Add visible and
visible_set args, don't know where these had gone, I thought they
used to be there

* gtk/testtext.c: Add a menu item to apply invisibility tag;
now we can test the feature and see that it's totally broken.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktexttag.c
gtk/testtext.c
tests/testtext.c

index c099cb80a64cbe6f7b2bc9940313e3e7c588fc52..842f540d94c7ae7209b806c003a9f8244c37bcb1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2000-11-08  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktexttag.c (gtk_text_tag_class_init): Add visible and
+       visible_set args, don't know where these had gone, I thought they
+       used to be there
+
+       * gtk/testtext.c: Add a menu item to apply invisibility tag;
+       now we can test the feature and see that it's totally broken.
+
 2000-11-08  Havoc Pennington  <hp@pobox.com>
 
         Make DND copy pixbufs and tags when source and target share a 
@@ -6,7 +15,7 @@
        * gtk/gtktextview.c (gtk_text_view_drag_data_get): provide the
        in-process GTK_TEXT_BUFFER_CONTENTS target
        (gtk_text_view_drag_data_received): Paste from
-       GTK_TEXT_BUFFER_CONTENTS if we receive it.      
+       GTK_TEXT_BUFFER_CONTENTS if we receive it.
 
 2000-11-08  Alexander Larsson  <alexl@redhat.com>
 
index c099cb80a64cbe6f7b2bc9940313e3e7c588fc52..842f540d94c7ae7209b806c003a9f8244c37bcb1 100644 (file)
@@ -1,3 +1,12 @@
+2000-11-08  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktexttag.c (gtk_text_tag_class_init): Add visible and
+       visible_set args, don't know where these had gone, I thought they
+       used to be there
+
+       * gtk/testtext.c: Add a menu item to apply invisibility tag;
+       now we can test the feature and see that it's totally broken.
+
 2000-11-08  Havoc Pennington  <hp@pobox.com>
 
         Make DND copy pixbufs and tags when source and target share a 
@@ -6,7 +15,7 @@
        * gtk/gtktextview.c (gtk_text_view_drag_data_get): provide the
        in-process GTK_TEXT_BUFFER_CONTENTS target
        (gtk_text_view_drag_data_received): Paste from
-       GTK_TEXT_BUFFER_CONTENTS if we receive it.      
+       GTK_TEXT_BUFFER_CONTENTS if we receive it.
 
 2000-11-08  Alexander Larsson  <alexl@redhat.com>
 
index c099cb80a64cbe6f7b2bc9940313e3e7c588fc52..842f540d94c7ae7209b806c003a9f8244c37bcb1 100644 (file)
@@ -1,3 +1,12 @@
+2000-11-08  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktexttag.c (gtk_text_tag_class_init): Add visible and
+       visible_set args, don't know where these had gone, I thought they
+       used to be there
+
+       * gtk/testtext.c: Add a menu item to apply invisibility tag;
+       now we can test the feature and see that it's totally broken.
+
 2000-11-08  Havoc Pennington  <hp@pobox.com>
 
         Make DND copy pixbufs and tags when source and target share a 
@@ -6,7 +15,7 @@
        * gtk/gtktextview.c (gtk_text_view_drag_data_get): provide the
        in-process GTK_TEXT_BUFFER_CONTENTS target
        (gtk_text_view_drag_data_received): Paste from
-       GTK_TEXT_BUFFER_CONTENTS if we receive it.      
+       GTK_TEXT_BUFFER_CONTENTS if we receive it.
 
 2000-11-08  Alexander Larsson  <alexl@redhat.com>
 
index c099cb80a64cbe6f7b2bc9940313e3e7c588fc52..842f540d94c7ae7209b806c003a9f8244c37bcb1 100644 (file)
@@ -1,3 +1,12 @@
+2000-11-08  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktexttag.c (gtk_text_tag_class_init): Add visible and
+       visible_set args, don't know where these had gone, I thought they
+       used to be there
+
+       * gtk/testtext.c: Add a menu item to apply invisibility tag;
+       now we can test the feature and see that it's totally broken.
+
 2000-11-08  Havoc Pennington  <hp@pobox.com>
 
         Make DND copy pixbufs and tags when source and target share a 
@@ -6,7 +15,7 @@
        * gtk/gtktextview.c (gtk_text_view_drag_data_get): provide the
        in-process GTK_TEXT_BUFFER_CONTENTS target
        (gtk_text_view_drag_data_received): Paste from
-       GTK_TEXT_BUFFER_CONTENTS if we receive it.      
+       GTK_TEXT_BUFFER_CONTENTS if we receive it.
 
 2000-11-08  Alexander Larsson  <alexl@redhat.com>
 
index c099cb80a64cbe6f7b2bc9940313e3e7c588fc52..842f540d94c7ae7209b806c003a9f8244c37bcb1 100644 (file)
@@ -1,3 +1,12 @@
+2000-11-08  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktexttag.c (gtk_text_tag_class_init): Add visible and
+       visible_set args, don't know where these had gone, I thought they
+       used to be there
+
+       * gtk/testtext.c: Add a menu item to apply invisibility tag;
+       now we can test the feature and see that it's totally broken.
+
 2000-11-08  Havoc Pennington  <hp@pobox.com>
 
         Make DND copy pixbufs and tags when source and target share a 
@@ -6,7 +15,7 @@
        * gtk/gtktextview.c (gtk_text_view_drag_data_get): provide the
        in-process GTK_TEXT_BUFFER_CONTENTS target
        (gtk_text_view_drag_data_received): Paste from
-       GTK_TEXT_BUFFER_CONTENTS if we receive it.      
+       GTK_TEXT_BUFFER_CONTENTS if we receive it.
 
 2000-11-08  Alexander Larsson  <alexl@redhat.com>
 
index c099cb80a64cbe6f7b2bc9940313e3e7c588fc52..842f540d94c7ae7209b806c003a9f8244c37bcb1 100644 (file)
@@ -1,3 +1,12 @@
+2000-11-08  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktexttag.c (gtk_text_tag_class_init): Add visible and
+       visible_set args, don't know where these had gone, I thought they
+       used to be there
+
+       * gtk/testtext.c: Add a menu item to apply invisibility tag;
+       now we can test the feature and see that it's totally broken.
+
 2000-11-08  Havoc Pennington  <hp@pobox.com>
 
         Make DND copy pixbufs and tags when source and target share a 
@@ -6,7 +15,7 @@
        * gtk/gtktextview.c (gtk_text_view_drag_data_get): provide the
        in-process GTK_TEXT_BUFFER_CONTENTS target
        (gtk_text_view_drag_data_received): Paste from
-       GTK_TEXT_BUFFER_CONTENTS if we receive it.      
+       GTK_TEXT_BUFFER_CONTENTS if we receive it.
 
 2000-11-08  Alexander Larsson  <alexl@redhat.com>
 
index c099cb80a64cbe6f7b2bc9940313e3e7c588fc52..842f540d94c7ae7209b806c003a9f8244c37bcb1 100644 (file)
@@ -1,3 +1,12 @@
+2000-11-08  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktexttag.c (gtk_text_tag_class_init): Add visible and
+       visible_set args, don't know where these had gone, I thought they
+       used to be there
+
+       * gtk/testtext.c: Add a menu item to apply invisibility tag;
+       now we can test the feature and see that it's totally broken.
+
 2000-11-08  Havoc Pennington  <hp@pobox.com>
 
         Make DND copy pixbufs and tags when source and target share a 
@@ -6,7 +15,7 @@
        * gtk/gtktextview.c (gtk_text_view_drag_data_get): provide the
        in-process GTK_TEXT_BUFFER_CONTENTS target
        (gtk_text_view_drag_data_received): Paste from
-       GTK_TEXT_BUFFER_CONTENTS if we receive it.      
+       GTK_TEXT_BUFFER_CONTENTS if we receive it.
 
 2000-11-08  Alexander Larsson  <alexl@redhat.com>
 
index 03d8aa9eac5dfb089b7deac31881b4af3f386a11..af9a300879c4c4df4eff98d111c65bfb2319e2ef 100644 (file)
@@ -92,7 +92,8 @@ enum {
   ARG_BG_FULL_HEIGHT,
   ARG_LANGUAGE,
   ARG_TABS,
-
+  ARG_INVISIBLE,
+  
   /* Whether-a-style-arg-is-set args */
   ARG_BACKGROUND_SET,
   ARG_FOREGROUND_SET,
@@ -116,6 +117,7 @@ enum {
   ARG_BG_FULL_HEIGHT_SET,
   ARG_LANGUAGE_SET,
   ARG_TABS_SET,
+  ARG_INVISIBLE_SET,
 
   LAST_ARG
 };
@@ -223,7 +225,9 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                            GTK_ARG_READWRITE, ARG_WRAP_MODE);
   gtk_object_add_arg_type ("GtkTextTag::tabs", GTK_TYPE_POINTER,
                            GTK_ARG_READWRITE, ARG_TABS);
-
+  gtk_object_add_arg_type ("GtkTextTag::invisible", GTK_TYPE_BOOL,
+                           GTK_ARG_READWRITE, ARG_INVISIBLE);
+  
   /* Style args are set or not */
   gtk_object_add_arg_type ("GtkTextTag::background_set", GTK_TYPE_BOOL,
                            GTK_ARG_READWRITE, ARG_BACKGROUND_SET);
@@ -269,7 +273,9 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                            GTK_ARG_READWRITE, ARG_WRAP_MODE_SET);
   gtk_object_add_arg_type ("GtkTextTag::tabs_set", GTK_TYPE_BOOL,
                            GTK_ARG_READWRITE, ARG_TABS_SET);
-
+  gtk_object_add_arg_type ("GtkTextTag::invisible_set", GTK_TYPE_BOOL,
+                           GTK_ARG_READWRITE, ARG_INVISIBLE_SET);
+  
 
   signals[EVENT] =
     gtk_signal_new ("event",
@@ -610,6 +616,12 @@ gtk_text_tag_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
       size_changed = TRUE;
       break;
 
+    case ARG_INVISIBLE:
+      text_tag->invisible_set = TRUE;
+      text_tag->values->invisible = GTK_VALUE_BOOL (*arg);
+      size_changed = TRUE;
+      break;
+      
       /* Whether the value should be used... */
 
     case ARG_BACKGROUND_SET:
@@ -706,6 +718,11 @@ gtk_text_tag_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
       size_changed = TRUE;
       break;
 
+    case ARG_INVISIBLE_SET:
+      text_tag->invisible_set = GTK_VALUE_BOOL (*arg);
+      size_changed = TRUE;
+      break;
+      
     default:
       g_assert_not_reached ();
       break;
index 12cfcd0899745bc68457979af2c61b46429ee703..5424dc0f7f14e6ba740cdad214a2a5658ba8fcc4 100644 (file)
@@ -20,6 +20,7 @@ struct _Buffer
   GtkTextBuffer *buffer;
   char *filename;
   gint untitled_serial;
+  GtkTextTag *invisible_tag;
   GtkTextTag *not_editable_tag;
   GtkTextTag *found_text_tag;
   GtkTextTag *custom_tabs_tag;
@@ -905,6 +906,32 @@ do_apply_editable (gpointer callback_data,
     }
 }
 
+static void
+do_apply_invisible (gpointer callback_data,
+                    guint callback_action,
+                    GtkWidget *widget)
+{
+  View *view = view_from_widget (widget);
+  GtkTextIter start;
+  GtkTextIter end;
+  
+  if (gtk_text_buffer_get_selection_bounds (view->buffer->buffer,
+                                            &start, &end))
+    {
+      if (callback_action)
+        {
+          gtk_text_buffer_remove_tag (view->buffer->buffer,
+                                      view->buffer->invisible_tag,
+                                      &start, &end);
+        }
+      else
+        {
+          gtk_text_buffer_apply_tag (view->buffer->buffer,
+                                     view->buffer->invisible_tag,
+                                     &start, &end);
+        }
+    }
+}
 
 static void
 do_apply_tabs (gpointer callback_data,
@@ -1087,6 +1114,8 @@ static GtkItemFactoryEntry menu_items[] =
   { "/_Attributes",      NULL,         0,                0, "<Branch>" },
   { "/Attributes/Editable",      NULL,         do_apply_editable, TRUE, NULL },
   { "/Attributes/Not editable",          NULL,         do_apply_editable, FALSE, NULL },
+  { "/Attributes/Invisible",             NULL,         do_apply_invisible, FALSE, NULL },
+  { "/Attributes/Visible",       NULL,         do_apply_invisible, TRUE, NULL },
   { "/Attributes/Custom tabs",           NULL,         do_apply_tabs, FALSE, NULL },
   { "/Attributes/Default tabs",          NULL,         do_apply_tabs, TRUE, NULL },
   { "/_Test",           NULL,         0,           0, "<Branch>" },
@@ -1254,6 +1283,11 @@ create_buffer (void)
   buffer->filename = NULL;
   buffer->untitled_serial = -1;
 
+  buffer->invisible_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
+  gtk_object_set (GTK_OBJECT (buffer->invisible_tag),
+                  "invisible", TRUE,
+                  NULL);
+  
   buffer->not_editable_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
   gtk_object_set (GTK_OBJECT (buffer->not_editable_tag),
                   "editable", FALSE,
index 12cfcd0899745bc68457979af2c61b46429ee703..5424dc0f7f14e6ba740cdad214a2a5658ba8fcc4 100644 (file)
@@ -20,6 +20,7 @@ struct _Buffer
   GtkTextBuffer *buffer;
   char *filename;
   gint untitled_serial;
+  GtkTextTag *invisible_tag;
   GtkTextTag *not_editable_tag;
   GtkTextTag *found_text_tag;
   GtkTextTag *custom_tabs_tag;
@@ -905,6 +906,32 @@ do_apply_editable (gpointer callback_data,
     }
 }
 
+static void
+do_apply_invisible (gpointer callback_data,
+                    guint callback_action,
+                    GtkWidget *widget)
+{
+  View *view = view_from_widget (widget);
+  GtkTextIter start;
+  GtkTextIter end;
+  
+  if (gtk_text_buffer_get_selection_bounds (view->buffer->buffer,
+                                            &start, &end))
+    {
+      if (callback_action)
+        {
+          gtk_text_buffer_remove_tag (view->buffer->buffer,
+                                      view->buffer->invisible_tag,
+                                      &start, &end);
+        }
+      else
+        {
+          gtk_text_buffer_apply_tag (view->buffer->buffer,
+                                     view->buffer->invisible_tag,
+                                     &start, &end);
+        }
+    }
+}
 
 static void
 do_apply_tabs (gpointer callback_data,
@@ -1087,6 +1114,8 @@ static GtkItemFactoryEntry menu_items[] =
   { "/_Attributes",      NULL,         0,                0, "<Branch>" },
   { "/Attributes/Editable",      NULL,         do_apply_editable, TRUE, NULL },
   { "/Attributes/Not editable",          NULL,         do_apply_editable, FALSE, NULL },
+  { "/Attributes/Invisible",             NULL,         do_apply_invisible, FALSE, NULL },
+  { "/Attributes/Visible",       NULL,         do_apply_invisible, TRUE, NULL },
   { "/Attributes/Custom tabs",           NULL,         do_apply_tabs, FALSE, NULL },
   { "/Attributes/Default tabs",          NULL,         do_apply_tabs, TRUE, NULL },
   { "/_Test",           NULL,         0,           0, "<Branch>" },
@@ -1254,6 +1283,11 @@ create_buffer (void)
   buffer->filename = NULL;
   buffer->untitled_serial = -1;
 
+  buffer->invisible_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
+  gtk_object_set (GTK_OBJECT (buffer->invisible_tag),
+                  "invisible", TRUE,
+                  NULL);
+  
   buffer->not_editable_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
   gtk_object_set (GTK_OBJECT (buffer->not_editable_tag),
                   "editable", FALSE,